#!/bin/bash

chiapath=/home/chiap
kv=32
mem=11000
queue=30
fp=3033845286
fk=a070409fbd89235da41f572bff42f2201b99220cf3d98bc41b068bd1585fe78f08481a66e47d4a5d4813cd6cacccac08
pk=ab844b520c17cb8fd4f951f9c9bb700a2b40becb0b43623151f92228d72647c9f6555acb868c20e72d150c07085a1b88

thread=4

runFun(){
    if [ -d $chiapath ];then
      tempath="/home/$1"
      if [ -d $tempath ];then
        nohup chia plots create -k $kv -b $mem -a $fp -f $fk -p $pk -e -r $thread -n $queue -t $tempath -2 $tempath -d $chiapath >> plots$2.log 2>&1 &
      fi
    fi
}

cd chia-blockchain
. ./activate
chia start farmer-only

echo "-----函数开始执行-----"
runFun nvme0n1 00
runFun nvme1n1 10
runFun nvme2n1 20
runFun nvme3n1 30
runFun nvme4n1 40
runFun nvme5n1 50
runFun nvme6n1 60
runFun nvme7n1 70
runFun nvme8n1 80
sleep 5500
runFun nvme0n1 01
runFun nvme1n1 11
runFun nvme2n1 21
runFun nvme3n1 31
runFun nvme4n1 41
runFun nvme5n1 51
runFun nvme6n1 61
runFun nvme7n1 71
runFun nvme8n1 81
sleep 5500
runFun nvme0n1 02
runFun nvme1n1 12
runFun nvme2n1 22
runFun nvme3n1 32
runFun nvme4n1 42
runFun nvme5n1 52
runFun nvme6n1 62
runFun nvme7n1 72
runFun nvme8n1 82
echo "-----函数执行完毕-----"
cd -
